﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

public partial class Admin_LostBook : System.Web.UI.Page
{
    public static string sqlpa = "";

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Cancel_Click(object sender, EventArgs e)
    {

        sqlpa = "select Book_info.BookID as 图书编号,Book_info.BookName as 图书条目,Book_info.Writer as 作者,Book_info.BookPlace as 馆藏地点,statusname as 状态 from Book_info,book_status  where Book_info.StatusID =3 and book_status.statusid=book_info.statusid ";
        SqlDataSource1.SelectCommand = sqlpa;



    }
    protected void baobiao_Click(object sender, EventArgs e)
    {

        SQL sql = new SQL();
        DataSet ds = sql.getDataset(sqlpa, "");
        DataTable dt = new DataTable();
        dt = ds.Tables[0];

        try
        {
            int dateflag = DateTime.Now.GetHashCode();
            OutFileDao.OutFileToDisk(dt, "丢失图书", "F:\\数据库课设\\BookManage\\reports\\丢失图书目录" + dateflag + ".xls");
            Response.AddHeader("Content-Disposition", "attachment;filename=" + "../reports/丢失图书目录" + dateflag + ".xls" + "");
            Response.TransmitFile("../reports/丢失图书目录" + dateflag + ".xls");//下载文件，backupath是你服务器上文件地址
            Response.Write("<script language=javascript>alert('导出成功');window.location = 'LostBook.aspx';</script>");
        }
        catch (System.Exception ex)
        {
            Response.Write("<script language=javascript>alert('失败，文件正在使用或路径错误');window.location = 'LostBook.aspx';</script>");
        }



    }


    protected void reader_Click(object sender, EventArgs e)
    {

        sqlpa = "select Book_info.BookID as 图书编号,Book_info.BookName as 图书条目,Book_info.Writer as 作者,Book_info.BookPlace as 馆藏地点,statusname as 状态 from Book_info,book_status  where Book_info.StatusID =3 and book_status.statusid=book_info.statusid";
        SqlDataSource1.SelectCommand = sqlpa;



    }

    protected void book_Click(object sender, EventArgs e)
    {

        sqlpa = "select Book_info.BookID as 图书编号,Book_info.BookName as 图书条目,Book_info.Writer as 作者,Book_info.BookPlace as 馆藏地点,statusname as 状态 from Book_info,book_status  where Book_info.StatusID =3 and book_status.statusid=book_info.statusid";
        SqlDataSource1.SelectCommand = sqlpa;




    }
}